Why is `goog.Disposable.call(this);` necessary?

Posted by David Faux on Stack Overflow See other posts from Stack Overflow or by David Faux
Published on 2012-06-20T15:12:13Z Indexed on 2012/06/20 15:16 UTC
Read the original article Hit count: 159

In this snippet of Google Closure javascript code involving a constructor, why is goog.Disposable.call(this); necessary? Doesn't Foo already inherit from Disposable with goog.inherits(foo, goog.Disposable);?

goog.provide('foo');
/**
 * @constructor
 */
foo = function(){
  goog.Disposable.call(this);
}

goog.inherits(foo, goog.Disposable);

foo.prototype.doSomething = function(){
  ...
}

foo.prototype.disposeInternal = function(){
  ...
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about google-closure-library